package com.ccjq.shosestore.core.utils;

public class PageBean {
	
	private int totalRows;   //������
	private int pageSize;    //ÿҳ��ʾ����
	private int totalPages;  //��ҳ��
	private int currentPage; //��ǰҳ��
    private int startRow;    //��ǰ��ʼ��������ǰ�У�
    
    public PageBean(int _totalRows)
    {
    	this.totalRows=_totalRows;
    	this.pageSize=6;
    	this.totalPages=1;
    	this.currentPage=1;
    	this.startRow=1;
    	this.totalPages=(totalRows%pageSize==0)?(totalRows/pageSize):(totalRows/pageSize+1);
    }
    
    
    
	public int getTotalRows() {
		return totalRows;
	}
	public void setTotalRows(int totalRows) {
		this.totalRows = totalRows;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getTotalPages() {
		return totalPages;
	}
	public void setTotalPages(int totalPages) {
		this.totalPages = totalPages;
	}
	public int getCurrentPage() {
		return currentPage;
	}
	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}
	public int getStartRow() {
		return startRow;
	}
	public void setStartRow(int startRow) {
		this.startRow = startRow;
	}
	
	
	//��ҳ
	public void First()
	{
		currentPage=1;
		startRow=1;
	}
	
	//��һҳ
	public void Up()
	{
		if(currentPage==1)
	   {
		 return;	
	   }
	
	startRow=(--currentPage-1)*pageSize+1;
		
	}
	
	//��һҳ
	public void Down()
	{
		if(currentPage<totalPages)
		{
			currentPage++;
		}
		
		startRow=(currentPage-1)*pageSize+1;
	}
	
    //βҳ
	public void last()
	{
		currentPage=totalPages;
	    startRow=(currentPage-1)*pageSize+1;
	}
	
	//ҳ����ת
	
	public void tiaozhuan(int _totalRows)
	{
		currentPage=_totalRows;
		if(currentPage>totalPages)
		{
			this.last();
		}
		else if(currentPage<1)
		{
			this.First();
		}
		startRow=(currentPage-1)*pageSize+1;	
	}
	
}
